package org.ourgrid.broker.business.requester;

import java.util.ArrayList;
import java.util.List;

import org.ourgrid.broker.business.controller.WorkerNotificationController;
import org.ourgrid.broker.request.WorkerDoNotifyFailureRequestTO;
import org.ourgrid.common.internal.IResponseTO;
import org.ourgrid.common.internal.RequesterIF;

import br.upe.dsc.patdown.control.PDController;

public class WorkerDoNotifyFailureRequester implements RequesterIF<WorkerDoNotifyFailureRequestTO> {

	public List<IResponseTO> execute(WorkerDoNotifyFailureRequestTO request) {
		List<IResponseTO> responses = new ArrayList<IResponseTO>();

		// change for pat-down is only the surrounding if statement.
		// if
		// (Controller.getInstance().shouldNotifyFailure(request.getWorkerPublicKey()))
		// {
		// doesn't finishes executing if all we change is this.
		// workerRecovery still gets called.
		// posterior job requests for the same worker then aren't done
		// properly.
		WorkerNotificationController.getInstance().doNotifyFailure(responses, request.getWorkerAddress(),
				request.getWorkerContainerID(), request.getWorkerPublicKey());
		// }

		return responses;
	}
}
